﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Account/NewAccountMasterPage.Master"
    AutoEventWireup="true" CodeBehind="ChangePersonalInfo.aspx.cs" Inherits="AteneoLibri.Account.ChangePersonalInfo" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Modifica dati personali</h2>
    <asp:Panel ID="pnlUpdate" runat="server">
        <div style="width: 100%; overflow: auto;">
            <div id="leftRegistration" class="Registration">
                <div>
                    Nome<br />
                    <asp:TextBox ID="txtName" runat="server" CssClass="StandardTextBox"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvName" runat="server" ErrorMessage="* Campo nome obbligatorio"
                        ValidationGroup="vgRec" ControlToValidate="txtName" Display="Dynamic" CssClass="failureNotification">*</asp:RequiredFieldValidator>
                </div>
                <div>
                    Cognome<br />
                    <asp:TextBox ID="txtSurname" runat="server" CssClass="StandardTextBox"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvSurname" runat="server" ErrorMessage="* Campo cognome obbligatorio"
                        ValidationGroup="vgRec" ControlToValidate="txtSurname" Display="Dynamic" CssClass="failureNotification">*</asp:RequiredFieldValidator>
                </div>
                <div>
                    Università<br />
                    <asp:DropDownList ID="ddlUniversity" runat="server" CssClass="StandardTextBox" DataTextField="Name"
                        AutoPostBack="True" AppendDataBoundItems="true" DataValueField="IdUniversity"
                        OnSelectedIndexChanged="ddlUniversity_SelectedIndexChanged">
                        <asp:ListItem Selected="True" Enabled="true" Value="0">-- Seleziona --</asp:ListItem>
                    </asp:DropDownList>
                </div>
                <div>
                    Facoltà<br />
                    <asp:DropDownList ID="ddlFaculty" runat="server" CssClass="StandardTextBox" DataTextField="Name"
                        DataValueField="IdFaculty" AppendDataBoundItems="true">
                        <asp:ListItem Selected="True" Enabled="true" Value="0">-- Seleziona --</asp:ListItem>
                    </asp:DropDownList>
                </div>
            </div>
            <div id="rightRegistration" class="Registration">
                <div>
                    Username<br />
                    <asp:TextBox ID="txtUsername" runat="server" CssClass="StandardTextBox"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvUsername" runat="server" ErrorMessage="* Campo username obbligatorio"
                        ValidationGroup="vgRec" ControlToValidate="txtUsername" Display="Dynamic" CssClass="failureNotification">*</asp:RequiredFieldValidator>
                    <asp:CustomValidator ID="cvUserName" runat="server" ErrorMessage="(*) Username già presente!"
                        ValidationGroup="vgRec" Display="Dynamic" ControlToValidate="txtUsername">(*)</asp:CustomValidator>
                    <asp:RegularExpressionValidator ID="regexpUsername" runat="server"     
                            ErrorMessage="(!) Sequenza di caratteri non valida. Sono ammessi solo caratteri alfanumerici, apici singoli, spazi e punti." ValidationGroup="vgRec"
                            ControlToValidate="txtUsername" CssClass="failureNotification"
                            ValidationExpression="^[a-zA-Z0-9'.\s]{1,20}$">(!)</asp:RegularExpressionValidator>
                </div>
                <div>
                    Email<br />
                    <asp:TextBox ID="txtEmail" runat="server" CssClass="StandardTextBox"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvEmail" runat="server" ErrorMessage="* Campo email obbligatorio"
                        ValidationGroup="vgRec" ControlToValidate="txtEmail" Display="Dynamic" CssClass="failureNotification">*</asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="revEmail" runat="server" ErrorMessage="** Formato email non valido"
                        ValidationGroup="vgRec" ControlToValidate="txtEmail" Display="Dynamic" CssClass="failureNotification"
                        ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">**</asp:RegularExpressionValidator>
                    <asp:CustomValidator ID="cvUser" runat="server" ErrorMessage="(*) Utente già registrato!"
                        ValidationGroup="vgRec" Display="Dynamic" ControlToValidate="txtEmail">(*)</asp:CustomValidator>
                </div>
            </div>
        </div>
        <div style="text-align: center; margin-top: 20px;">
            <asp:Button ID="btnUpdate" runat="server" CssClass="StandardButton" Text="Aggiorna" ValidationGroup="vgRec"
                OnClick="btnUpdate_Click" />&nbsp;
            <asp:Button ID="btnCancel" runat="server" CssClass="StandardButton" Text="Annulla" CausesValidation="false"
                OnClick="btnCancel_Click" />
        </div>
        <div class="ValidationBox">
            <asp:ValidationSummary ID="vsRegistrazione" runat="server" DisplayMode="BulletList"
                ValidationGroup="vgRec" CssClass="failureNotification" EnableClientScript="true"
                HeaderText="Attenzione:" />
        </div>
    </asp:Panel>
    <asp:Panel ID="pnlUpdateSuccessfullyCompleted" runat="server" Visible="false">
        <table>
            <tr>
                <td>
                    <asp:Image ID="Image1" runat="server" ImageUrl="~/Images/icon-success.png" />
                </td>
                <td style="vertical-align: middle; padding-left: 20px;">
                    <asp:Label ID="Label1" Text="Aggiornamento dati effettuato con successo!" runat="server"
                        CssClass="failureNotification"></asp:Label>
                </td>
            </tr>
        </table>
    </asp:Panel>
    <asp:Panel ID="pnlUpdateError" runat="server" Visible="false">
        <table>
            <tr>
                <td>
                    <asp:Image ID="Image2" runat="server" ImageUrl="~/Images/icon-denied.png" />
                </td>
                <td style="vertical-align: middle; padding-left: 20px;">
                    <asp:Label ID="Label2" Text="Errore durante l'aggiornameto. Lo username o la mail inseriti sono già stati registrati!"
                        runat="server" CssClass="failureNotification"></asp:Label>
                </td>
            </tr>
        </table>
    </asp:Panel>
    <asp:Panel ID="pnlRemoveAccount" runat="server">
        <div style="font-size: 15px; padding-top:30px;">
        <asp:HyperLink ID="lnkRemoveAccount" runat="server" NavigateUrl="~/Account/RemoveAccount.aspx" Text="Rimuovi il tuo profilo"></asp:HyperLink>
        </div>
    </asp:Panel>
</asp:Content>
